feat(linter): implement eslint/capitalized-comments#16896
feat(linter): implement eslint/capitalized-comments#16896camc314 merged 6 commits intooxc-project:mainfrom
Conversation
CodSpeed Performance ReportMerging #16896 will not alter performanceComparing Summary
Footnotes
|
9c08a76 to
212e2bb
Compare
212e2bb to
a9f011f
Compare
|
@tt-a1i how are you generating the test cases for these rule? I am noticing a lot of test cases missing in your PRs |
camc314
left a comment
There was a problem hiding this comment.
I re-ported the test cases from ESLint and some are failing.
These cases need to be fixed
|
I missed these; thank you for pointing them out. I'll fix these issues. |
Use original content instead of normalized content when checking for directive comments. This ensures that '//* eslint-disable' is NOT treated as a directive (because '*' precedes it), while '// eslint-disable' is correctly recognized as a directive. This fixes the failing test cases that camc314 ported from ESLint.
|
Thanks for porting the complete ESLint test cases! I found and fixed the failing tests. The issue was in The bug:
The fix: // Before: used normalized content
if is_directive_comment(&normalized) { continue; }
// After: use original content
if is_directive_comment(content) { continue; }All tests pass now. |
thanks! off to sleep, night 👋 |
|
We should probably add the |
… them. And add relevant tests. Following up on #16896.
…#16989) Follow-up to #16896. ## Summary Treat OxLint directive comments as directives in `eslint/capitalized-comments`, so we do not warn or auto-fix them. - Ignore `oxlint-disable`, `oxlint-disable-line`, `oxlint-disable-next-line` - Ignore `oxlint-enable` and related `oxlint-` directive prefixes - Add test coverage for these directive comment styles
# Oxlint ### 🚀 Features - 6cc3fdf linter/no-inferrable-types: Implement fixer (#17090) (camc314) - 2067997 linter/no-negation-in-equality-check: Implement suggestion (#17084) (camc314) - 552f9ef vscode: Auto-generate VSCode README configuration from package.json (#16970) (Copilot) - 9190c4b linter/no-unnecessary-array-flat-depth: Implement fixer (#17057) (camc314) - ed789de linter/misrefactored-assign-op: Implement fixer (#17056) (camc314) - a0f74a0 linter/config: Allow aliasing plugin names to allow names the same as builtin plugins (#15569) (Cameron) - a43d251 linter/plugins: `RuleTester` support `languageOptions.globals` (#17009) (overlookmotel) - 35070d9 linter/bad-bitwise-operator: Implement fixer (#17006) (camc314) - 322d995 linter/prefer-enum-initializers: Implement fixer (#17004) (camc314) - ae1e5bc vscode: Add support for tsgolint binary configuration (#16921) (ColemanDunn) - 3bfe31e linter/eslint-plugin-vitest: Add prefer-called-with as vitest compatible jest rule (#16993) (Said Atrahouch) - 0cd075f linter/eslint-plugin-jest: Add fix capabilities to prefer-called-with rule (#16987) (Said Atrahouch) - 357564b linter: Add options for `typescript/require-array-sort-compare` rule. (#16980) (connorshea) - 2b0ffba linter: Add options for `typescript/no-meaningless-void-operator` rule. (#16981) (connorshea) - 8bc4287 linter/plugins: Validate options against schema (#16974) (overlookmotel) - fdc7d08 linter: Implement eslint/capitalized-comments (#16896) (Tu Shaokun) - f8b6561 linter: Add support for `test.for` in vitest (#16925) (camchenry) - 7ee0379 linter/eslint-plugin-vitest: Implement prefer-spy-on (#16426) (Said Atrahouch) - fc96ee0 linter: Implement jest/prefer-to-have-been-called-times (#16938) (秦宇航) - 291b57b ast_tools: Generate TS declaration files for deserializer and walk files (#16912) (camc314) - e31da2a linter: Implement jest/perfer-to-have-been-called (#16899) (秦宇航) - 1a31306 linter/eslint-plugin-vitest: Add require-hook as vitest compatible jest rule (#16880) (Said Atrahouch) - cd3db21 linter: Add ignoredTypeNames option to no-base-to-string rule (#16898) (camc314) - 763b25a linter: Implement eslint/no-inline-comments (#16885) (Tu Shaokun) ### 🐛 Bug Fixes - fb9e193 linter: OOM problems with custom plugins (#17082) (overlookmotel) - 005ec25 linter: Permit `$schema` `.oxlintrc.json` struct (#17060) (Copilot) - fd03131 linter/plugins: Handle plugin names containing slashes (#17073) (overlookmotel) - b2a4fac linter/plugins: Error if plugin name alias is not normalized (#17071) (overlookmotel) - e046c4e linter/no-misused-spread: Add rule options support (#17054) (camc314) - 5c1a9e0 linter/no-deprecated: Add rule options support (#17053) (camc314) - 8c9cafe linter: `import/consistent-type-specifier-style`: add support for declaration files (#16979) (camchenry) - dab4780 linter/no-empty-pattern: Misleading help message for arrays (#17039) (Copilot) - 67f8c5d linter/plugins: Get correct plugin name in all cases (#17033) (overlookmotel) - 674dab9 linter/plugins: Fix indentation in error message (#17018) (overlookmotel) - 6524f72 linter/plugins: Add `@types/node` dev dependency to `oxlint` package (#17016) (overlookmotel) - 7a35513 linter/plugins: Better error for `null` in `globals` in `RuleTester` (#17011) (overlookmotel) - 42603ba linter/plugins: Always define `languageOptions.globals` (#17008) (overlookmotel) - 4cdc2f8 linter: Fix VITEST override rule list and add test for alphabetizing the two lists (#16975) (Connor Shea) - e466562 linter/consistent-type-definitions: Handle parenthesized types in rule (#16998) (camc314) - fce267c linter: Correct vitest plugin source to be `@vitest/eslint-plugin` (#16976) (connorshea) - 477bb57 linter: Fix `vitest/no-restricted-vi-methods` and add tests for it. (#16971) (connorshea) - 7d6974d linter: Ignore oxlint directive comments in capitalized-comments (#16989) (Tu Shaokun) - 23ac6b1 linter/plugins: Apply defaults from `meta.schema` to options (#16930) (overlookmotel) - 2f946cf linter/plugins: Error if `defaultOptions` is not JSON-serializable (#16959) (overlookmotel) - d8b8a57 linter/plugins: Freeze whole of merged options (#16958) (overlookmotel) - d446c43 linter: Prevent extra fields from being present on oxlint config file (#16874) (connorshea) - b845871 linter/plugins: Correctly handle object with `__proto__` keys in options merging (#16928) (overlookmotel) - c897794 linter: Fix eslint/sort-imports allowSeparatedGroups not working with single empty line (#16012) (Duc Nghiem Xuan) - 0c347a1 linter/array-type: Handle satisfies expression (#16903) (camc314) ### ⚡ Performance - 70d853c linter: Avoid cloning source text when cloning AST into fixed-size allocator (#17088) (overlookmotel) - 4d389f7 linter: Less bounds checks in `normalize_plugin_name` (#17030) (overlookmotel) - fd8e9c6 linter/plugins: Speed up cloning JSON objects (#16997) (overlookmotel) - d77e22d linter/plugins: Use `DEFAULT_OPTIONS` for rules with empty array as default options (#16913) (overlookmotel) ### 📚 Documentation - 6d053b4 linter: Fix typo in doc comment (#17091) (overlookmotel) - b5f3c91 linter: Document intentional exclusion of ignoreCase option in jsx-no-duplicate-props (#17046) (Copilot) - a0bf5d8 linter: Fix the config option docs for no-inline-comments rule. (#16983) (connorshea) - ca26a11 linter/plugins: Fix typo in doc comment (#16966) (overlookmotel) - 3183bf8 linter/plugins: Fix typo in JSDoc comment (#16900) (overlookmotel) # Oxfmt ### 🚀 Features - 15dfb55 oxfmt: Respect single nearest `.editorconfig` (#17043) (leaysgur) - 8c33ff4 oxfmt: Expose Node.js API: `format(fileName, sourceText, options?)` (#16939) (leaysgur) ### 🐛 Bug Fixes - d340c87 oxfmt: Update api `FormatOptions` type with `& Record<string, unknown>` (#17036) (leaysgur) - 827a256 oxfmt: Place ignorePatterns at bottom of JSON in --migrate prettier (#16926) (Boshen) Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>
|
Just checking in here since this was merged recently – was it intentional to make this rule enabled by default? |
Can you share your |
Here's the config in use
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/refs/heads/main/npm/oxlint/configuration_schema.json",
"plugins": [
"import",
"jest",
"jsdoc",
"jsx-a11y",
"node",
"oxc",
"promise",
"react-perf",
"react",
"typescript",
"unicorn",
"vitest"
],
"jsPlugins": null,
"categories": {
"correctness": "error",
"perf": "error",
"suspicious": "error",
"style": "error",
"pedantic": "error"
},
"rules": {
// ┌──────────────────────────────────────────────────────────┐
// │ Allowed │
// └──────────────────────────────────────────────────────────┘
// We don't require exports to be at the end of a file
"exports-last": "off",
// We allow `continue` statements
"no-continue": "off",
// These must remain off (for now) to allow separate
// `type` imports and value imports from the same module
"no-duplicate-imports": "off",
"import/no-duplicates": "off",
// We don't allow these but have a pre-commit hook to block them
"no-focused-tests": "off",
// We allow (and encourage!) named exports
"no-named-export": "off",
// We do not prefer default exports
"prefer-default-export": "off",
// We allow ternaries and nested ternary expressions
"unicorn/no-nested-ternary": "off",
"no-nested-ternary": "off",
"no-ternary": "off",
// We allow `null`
"no-null": "off",
// We allow unassigned imports (e.g. for side effects)
"no-unassigned-import": "off",
// We allow seemingly-redundant returns when appropriate
"no-useless-return": "off",
// We sort imports using Prettier instead
"sort-imports": "off",
// We don't enforce key sorting in objects
"sort-keys": "off",
// We don't require exports to be in a single group
"import/group-exports": "off",
// We permit `* as` imports
"import/no-namespace": "off",
// We allow "confusing" setTimeout usage
"jest/no-confusing-set-timeout": "off",
// We allow before/after/etc hooks in our tests
"jest/no-hooks": "off",
// We allow code outside of hooks in test files
"jest/require-hook": "off",
// We don't enforce JSDoc tag names
"jsdoc/check-tag-names": "off",
// We use the new React JSX transform
"react/react-in-jsx-scope": "off",
// We permit both forms of array type notation
"typescript/array-type": "off",
// ┌──────────────────────────────────────────────────────────┐
// │ Warnings │
// └──────────────────────────────────────────────────────────┘
// Warn if React hook dependencies are missing
"react/exhaustive-deps": "warn",
// Bug: Oxlint currently misidentifies some correct usages
"unicorn/no-array-method-this-argument": "warn",
// ┌──────────────────────────────────────────────────────────┐
// │ Errors │
// └──────────────────────────────────────────────────────────┘
// Enforce that non-static class methods use `this`
// or are made static
// TODO: <redacted>
"class-methods-use-this": "warn", // Set to `error`
// We require switches to have a default case
// (or a `no-default` comment)
"default-case": "error",
// Disallow direct use of alert/confirm/prompt
// TODO: <redacted>
"no-alert": "warn", // Set to `error`
// We disallow direct use of `console`
"no-console": "error",
// Empty functions are disallowed
"no-empty-function": "error",
// Empty blocks are disallowed
"no-empty": "error",
// Use of __iterator__ is disallowed
"no-iterator": "error",
// Enforce that numeric literals are assigned to named variables
"no-magic-numbers": [
// TODO: <redacted>
"warn", // Set to `error`
{
"ignoreArrayIndexes": true,
"ignoreDefaultValues": true,
"ignoreClassFieldInitialValues": true,
"ignoreEnums": true,
"ignoreNumericLiteralTypes": true,
"ignoreReadonlyClassProperties": true,
"ignoreTypeIndexes": true,
"ignore": [
// Very common numbers
-1, 0, 1, 2,
// HTTP response codes
100, 101, 102, 103, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226,
300, 301, 302, 303, 304, 305, 307, 308, 400, 401, 402, 403, 404, 405,
406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421,
422, 423, 424, 425, 426, 428, 429, 431, 451, 500, 501, 502, 503, 504,
505, 506, 507, 508, 509, 510, 511
]
}
],
// Parameter reassignment is disallowed
"no-param-reassign": "error",
// Use of __proto__ is disallowed
"no-proto": "error",
// We enforce `{n}` for multiple spaces in regexes
"no-regex-spaces": "error",
// We disallow certain imports
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "sinon",
"importNames": ["sinon", "default"],
"message": "Please use createSinonSandbox() instead"
}
]
}
],
// Unused variables are disallowed
"no-unused-vars": [
"error",
{
// Permit unused variables that start with `_`
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_"
}
],
// `var` is disallowed
"no-var": "error",
// require(`${something}`) is disallowed
"import/no-dynamic-require": "error",
// Disallow unnamed default exports
// TODO: <redacted>
"import/no-anonymous-default-export": "warn", // Set to `error`
// Webpack !loader syntax is disallowed
"import/no-webpack-loader-syntax": "error",
// We enforce hook order (e.g. `before` comes prior to `after`)
"jest/prefer-hooks-in-order": "error",
// Empty JSDoc tags are disallowed
"jsdoc/empty-tags": "error",
// `dangerouslySetInnerHTML` is disallowed
"react/no-danger": "error",
// Disallow non-existent DOM properties
"react/no-unknown-property": "error",
// Disallow using `delete` on dynamic properties
// TODO: <redacted>
"typescript/no-dynamic-delete": "warn", // Set to `error`
// Disallow `{}` as a type
// TODO: <redacted>
"typescript/no-empty-object-type": "warn", // Set to `error`
// Enforce consistent `import type` usage
"typescript/no-import-type-side-effects": "error",
"typescript/consistent-type-imports": [
"error",
{
"prefer": "type-imports",
"fixStyle": "separate-type-imports",
"disallowTypeAnnotations": true
}
],
// Disallow defining TypeScript namespaces
"typescript/no-namespace": "error",
// Disallow blanket `eslint-disable` comments
"unicorn/no-abusive-eslint-disable": "error",
// Enforce use of the `node:` protocol when importing Node.js built-ins
"unicorn/prefer-node-protocol": "error",
// ┌──────────────────────────────────────────────────────────┐
// │ Temporarily disabled for migration from ESLint │
// └──────────────────────────────────────────────────────────┘
/*
* These rules are on by default for our enabled categories, but
* have been disabled temporarily while we migrate from ESLint
* to Oxlint.
*
* The number of existing violations for each rule is indicated
* in each TODO comment.
*
* To re-enable a rule, delete it from this section and address
* any errors that occur.
*
* If a rule seems like should remain off permanently (e.g. it
* is unwanted), please start a discussion on the ticket
* linked in the rule's TODO.
*
* TIPS:
* - Use `--quiet` to hide warnings from lint output.
* - Use `--fix` to automatically fix issues (where available).
* - Use `git diff --name-only dev | xargs yarn prettier --write`
* to format only changed files (faster than pre-commit).
*/
// ----------------------------------------------------------
// High-impact errors (>500 errors per rule)
// ----------------------------------------------------------
// TODO: <redacted>
"unicorn/filename-case": "off",
// TODO: <redacted>
"max-lines-per-function": "off",
// TODO: <redacted>
"id-length": "off",
// TODO: <redacted>
"init-declarations": "off",
// TODO: <redacted>
"unicorn/numeric-separators-style": "off",
// TODO: <redacted>
"func-style": "off",
// TODO: <redacted>
"import/max-dependencies": "off",
// TODO: <redacted>
"react-perf/jsx-no-new-object-as-prop": "off",
// TODO: <redacted>
"react-perf/jsx-no-new-function-as-prop": "off",
// TODO: <redacted>
"jsdoc/require-param": "off",
// TODO: <redacted>
"jest/no-conditional-in-test": "off",
// TODO: <redacted>
"unicorn/catch-error-name": "off",
// TODO: <redacted>
"no-warning-comments": "off",
// TODO: <redacted>
"no-implicit-coercion": "off",
// TODO: <redacted>
"promise/prefer-await-to-then": "off",
// TODO: <redacted>
"react-perf/jsx-no-new-array-as-prop": "off",
// TODO: <redacted>
"react/jsx-props-no-spreading": "off",
// TODO: <redacted>
"jsdoc/require-returns": "off",
// TODO: <redacted>
"no-negated-condition": "off",
// TODO: <redacted>
"new-cap": "off",
// TODO: <redacted>
"prefer-destructuring": "off",
// TODO: <redacted>
"unicorn/no-await-expression-member": "off",
// TODO: <redacted>
"jest/expect-expect": "off",
// TODO: <redacted>
"oxc/no-map-spread": "off",
// TODO: <redacted>
"jest/prefer-lowercase-title": "off",
// ----------------------------------------------------------
// Medium-impact errors (100-500 errors per rule)
// ----------------------------------------------------------
// TODO: <redacted>
"unicorn/prefer-global-this": "off",
// TODO: <redacted>
"max-params": "off",
// TODO: <redacted>
"unicorn/no-array-sort": "off",
// TODO: <redacted>
"typescript/prefer-ts-expect-error": "off",
// TODO: <redacted>
"unicorn/prefer-spread": "off",
// TODO: <redacted>
"promise/always-return": "off",
// TODO: <redacted>
"unicorn/no-useless-undefined": "off",
// TODO: <redacted>
"oxc/no-accumulating-spread": "off",
// TODO: <redacted>
"typescript/ban-types": "off",
// TODO: <redacted>
"promise/prefer-await-to-callbacks": "off",
// TODO: <redacted>
"curly": "off",
// TODO: <redacted>
"max-lines": "off",
// TODO: <redacted>
"jest/consistent-test-it": "off",
// TODO: <redacted>
"react-perf/jsx-no-jsx-as-prop": "off",
// TODO: <redacted>
"unicorn/switch-case-braces": "off",
// TODO: <redacted>
"unicorn/no-array-callback-reference": "off",
// TODO: <redacted>
"typescript/consistent-indexed-object-style": "off",
// TODO: <redacted>
"react/jsx-no-useless-fragment": "off",
// TODO: <redacted>
"unicorn/text-encoding-identifier-case": "off",
// TODO: <redacted>
"unicorn/prefer-object-from-entries": "off",
// TODO: <redacted>
"promise/avoid-new": "off",
// TODO: <redacted>
"unicorn/prefer-string-replace-all": "off",
// TODO: <redacted>
"unicorn/new-for-builtins": "off",
// TODO: <redacted>
"unicorn/prefer-array-flat-map": "off",
// TODO: <redacted>
"unicorn/no-useless-spread": "off",
// TODO: <redacted>
"jest/no-standalone-expect": "off",
// TODO: <redacted>
"jest/valid-title": "off",
// TODO: <redacted>
"unicorn/prefer-dom-node-append": "off",
// TODO: <redacted>
"unicorn/prefer-array-some": "off",
// TODO: <redacted>
"jest/padding-around-test-blocks": "off",
// TODO: <redacted>
"unicorn/throw-new-error": "off",
// TODO: <redacted>
"preserve-caught-error": "off",
// TODO: <redacted>
"unicorn/prefer-date-now": "off",
// TODO: <redacted>
"unicorn/no-typeof-undefined": "off",
// TODO: <redacted>
"unicorn/prefer-at": "off",
// ----------------------------------------------------------
// Low-impact errors (<100 errors per rule)
// ----------------------------------------------------------
// TODO: <redacted>
"unicorn/no-useless-fallback-in-spread": "off",
// TODO: <redacted>
"unicorn/consistent-function-scoping": "off",
// TODO: <redacted>
"react/jsx-pascal-case": "off",
// TODO: <redacted>
"jsdoc/require-param-type": "off",
// TODO: <redacted>
"unicorn/prefer-string-slice": "off",
// TODO: <redacted>
"unicorn/prefer-set-has": "off",
// TODO: <redacted>
"unicorn/no-new-array": "off",
// TODO: <redacted>
"jsdoc/require-returns-type": "off",
// TODO: <redacted>
"unicorn/prefer-query-selector": "off",
// TODO: <redacted>
"unicorn/prefer-string-raw": "off",
// TODO: <redacted>
"eqeqeq": "off",
// TODO: <redacted>
"unicorn/prefer-negative-index": "off",
// TODO: <redacted>
"unicorn/no-lonely-if": "off",
// TODO: <redacted>
"unicorn/no-useless-promise-resolve-reject": "off",
// TODO: <redacted>
"no-empty-pattern": "off",
// TODO: <redacted>
"unicorn/require-array-join-separator": "off",
// TODO: <redacted>
"unicorn/prefer-structured-clone": "off",
// TODO: <redacted>
"react/jsx-fragments": "off",
// TODO: <redacted>
"jest/no-done-callback": "off",
// TODO: <redacted>
"jest/no-disabled-tests": "off",
// TODO: <redacted>
"unicorn/prefer-native-coercion-functions": "off",
// TODO: <redacted>
"jest/valid-expect": "off",
// TODO: <redacted>
"jest/valid-describe-callback": "off",
// TODO: <redacted>
"unicorn/prefer-array-find": "off",
// TODO: <redacted>
"unicorn/prefer-logical-operator-over-ternary": "off",
// TODO: <redacted>
"typescript/consistent-generic-constructors": "off",
// TODO: <redacted>
"unicorn/consistent-existence-index-check": "off",
// TODO: <redacted>
"promise/no-nesting": "off",
// TODO: <redacted>
"max-depth": "off",
// TODO: <redacted>
"unicorn/no-this-assignment": "off",
// TODO: <redacted>
"react/no-array-index-key": "off",
// TODO: <redacted>
"jest/prefer-strict-equal": "off",
// TODO: <redacted>
"unicorn/prefer-type-error": "off",
// TODO: <redacted>
"unicorn/prefer-add-event-listener": "off",
// TODO: <redacted>
"unicorn/no-array-reverse": "off",
// TODO: <redacted>
"jest/prefer-called-with": "off",
// TODO: <redacted>
"import/no-named-as-default": "off",
// TODO: <redacted>
"jest/no-identical-title": "off",
// TODO: <redacted>
"unicorn/escape-case": "off",
// TODO: <redacted>
"unicorn/no-zero-fractions": "off",
// TODO: <redacted>
"unicorn/no-empty-file": "off",
// TODO: <redacted>
"no-await-in-loop": "off",
// TODO: <redacted>
"unicorn/prefer-regexp-test": "off",
// TODO: <redacted>
"jest/no-commented-out-tests": "off",
// TODO: <redacted>
"react/iframe-missing-sandbox": "off",
// TODO: <redacted>
"jest/max-expects": "off",
// TODO: <redacted>
"unicorn/require-number-to-fixed-digits-argument": "off",
// TODO: <redacted>
"unicorn/consistent-assert": "off",
// TODO: <redacted>
"func-names": "off",
// TODO: <redacted>
"unicorn/prefer-bigint-literals": "off",
// TODO: <redacted>
"unicorn/prefer-top-level-await": "off",
// TODO: <redacted>
"jsdoc/require-param-description": "off",
// TODO: <redacted>
"unicorn/no-object-as-default-parameter": "off",
// TODO: <redacted>
"react/jsx-handler-names": "off",
// TODO: <redacted>
"radix": "off",
// TODO: <redacted>
"react/no-set-state": "off",
// TODO: <redacted>
"jest/no-export": "off",
// TODO: <redacted>
"unicorn/prefer-array-index-of": "off",
// TODO: <redacted>
"react/jsx-key": "off",
// TODO: <redacted>
"promise/no-callback-in-promise": "off",
// TODO: <redacted>
"unicorn/no-unnecessary-array-flat-depth": "off",
// TODO: <redacted>
"unicorn/no-unreadable-array-destructuring": "off",
// TODO: <redacted>
"promise/param-names": "off",
// TODO: <redacted>
"promise/no-multiple-resolved": "off",
// TODO: <redacted>
"jsx-a11y/click-events-have-key-events": "off",
// TODO: <redacted>
"jest/max-nested-describe": "off",
// TODO: <redacted>
"unicorn/prefer-code-point": "off",
// ----------------------------------------------------------
// One-off errors (<=10 errors per rule)
// ----------------------------------------------------------
// TODO: <redacted>
"unicorn/require-post-message-target-origin": "off",
// TODO: <redacted>
"unicorn/no-hex-escape": "off",
// TODO: <redacted>
"unicorn/prefer-includes": "off",
// TODO: <redacted>
"jest/no-duplicate-hooks": "off",
// TODO: <redacted>
"unicorn/prefer-event-target": "off",
// TODO: <redacted>
"unicorn/no-unnecessary-slice-end": "off",
// TODO: <redacted>
"jsdoc/require-returns-description": "off",
// TODO: <redacted>
"typescript/no-extraneous-class": "warn",
// TODO: <redacted>
"unicorn/no-useless-length-check": "off",
// TODO: <redacted>
"unicorn/no-single-promise-in-promise-methods": "off",
// TODO: <redacted>
"typescript/no-unsafe-function-type": "off",
// TODO: <redacted>
"no-loop-func": "warn",
// TODO: <redacted>
"oxc/no-async-endpoint-handlers": "off",
// TODO: <redacted>
"vitest/no-conditional-tests": "off",
// TODO: <redacted>
"unicorn/no-useless-switch-case": "off",
// TODO: <redacted>
"no-else-return": "off",
// TODO: <redacted>
"unicorn/explicit-length-check": "off",
// TODO: <redacted>
"unicorn/no-thenable": "off",
// TODO: <redacted>
"unicorn/no-instanceof-builtins": "off",
// TODO: <redacted>
"jsx-a11y/prefer-tag-over-role": "off",
// TODO: <redacted>
"typescript/ban-ts-comment": "off",
// TODO: <redacted>
"no-array-constructor": "off",
// TODO: <redacted>
"vitest/prefer-to-be-falsy": "off",
// TODO: <redacted>
"unicorn/prefer-set-size": "off",
// TODO: <redacted>
"jest/require-top-level-describe": "off",
// TODO: <redacted>
"jest/prefer-to-be": "off",
// TODO: <redacted>
"jest/prefer-each": "off",
// TODO: <redacted>
"jest/no-untyped-mock-factory": "off",
// TODO: <redacted>
"jest/no-conditional-expect": "off",
// TODO: <redacted>
"typescript/prefer-enum-initializers": "off",
// TODO: <redacted>
"unicorn/prefer-prototype-methods": "off",
// TODO: <redacted>
"unicorn/prefer-array-flat": "off",
// TODO: <redacted>
"unicorn/no-instanceof-array": "off",
// TODO: <redacted>
"react/rules-of-hooks": "off",
// TODO: <redacted>
"unicorn/prefer-string-starts-ends-with": "off",
// TODO: <redacted>
"promise/prefer-catch": "off",
// TODO: <redacted>
"promise/no-return-wrap": "off",
// TODO: <redacted>
"jsx-a11y/media-has-caption": "off",
// TODO: <redacted>
"jsx-a11y/label-has-associated-control": "off",
// TODO: <redacted>
"jest/prefer-hooks-on-top": "off",
// TODO: <redacted>
"sort-vars": "off",
// TODO: <redacted>
"no-throw-literal": "off",
// TODO: <redacted>
"no-lonely-if": "off",
// TODO: <redacted>
"unicorn/prefer-math-trunc": "off",
// TODO: <redacted>
"unicorn/prefer-dom-node-remove": "off",
// TODO: <redacted>
"unicorn/no-unnecessary-array-splice-count": "off",
// TODO: <redacted>
"unicorn/no-static-only-class": "off",
// TODO: <redacted>
"react/checked-requires-onchange-or-readonly": "off",
// TODO: <redacted>
"vitest/prefer-to-be-truthy": "off",
// TODO: <redacted>
"unicorn/prefer-dom-node-text-content": "off",
// TODO: <redacted>
"unicorn/number-literal-case": "off",
// TODO: <redacted>
"unicorn/no-invalid-remove-event-listener": "off",
// TODO: <redacted>
"unicorn/consistent-date-clone": "off",
// TODO: <redacted>
"react/style-prop-object": "off",
// TODO: <redacted>
"promise/no-promise-in-callback": "off",
// TODO: <redacted>
"jsx-a11y/no-redundant-roles": "off",
// TODO: <redacted>
"jest/prefer-to-have-length": "off"
},
"overrides": [
// Permit `new` without variable assignment for infra code
{
"files": ["backend-support/pulumi-utils/**/*", "**/src/infra/*"],
"rules": {
"no-new": "allow"
}
},
// Remove line and length limits for mocks and fixtures
{
"files": ["**/mocks.ts", "**/mocks/*", "**/fixtures/*"],
"rules": {
"max-lines": 0,
"max-len": 0
}
},
// Permit parameter reassignment in reducers and slices
{
"files": ["**/reducer.ts", "**/slice.ts"],
"rules": {
"no-param-reassign": "allow"
}
},
{
"files": ["**/*.{test,spec}.*"],
"rules": {
// Permit expect expressions
"no-unused-expressions": "allow",
// Allow longer test files
"max-lines": [
// TODO: <redacted>
"warn", // Set to `error`
450
]
}
},
// Nock needs to use `function` syntax to access `this`
{
"files": ["**/mocks/**"],
"rules": {
"func-names": "allow"
}
},
// TypeScript files don't need param types
{
"files": ["**/*.{ts,tsx}"],
"rules": {
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off"
}
},
// TSX and JSX files can skip JSDoc params and returns since
// they are typically components
{
"files": ["**/*.{tsx,jsx}"],
"rules": {
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off"
}
},
// Files that declare namespaces are permitted to use type annotations
{
"files": [
// If a file uses `declare namespace`, it can be added to this list
"**/express.d.ts",
"cypress/support/index.d.ts"
],
"rules": {
"typescript/consistent-type-imports": [
"error",
{ "disallowTypeAnnotations": false }
]
}
}
],
"settings": {
"jsx-a11y": {
"polymorphicPropName": null,
"components": {},
"attributes": {}
},
"next": {
"rootDir": []
},
"react": {
"formComponents": [],
"linkComponents": []
},
"jsdoc": {
"ignorePrivate": false,
"ignoreInternal": false,
"ignoreReplacesDocs": true,
"overrideReplacesDocs": true,
"augmentsExtendsReplacesDocs": false,
"implementsReplacesDocs": false,
"exemptDestructuredRootsFromChecks": false,
"tagNamePreference": {}
}
},
"env": {
"builtin": true
},
"globals": {},
"ignorePatterns": [
// <redacted>
]
}
|
|
It looks like the rule is treated as an error by the oxc VSCode extension, but not by oxlint on the command line. I'd be happy to set up a basic reproduction repo if that would be helpful – we just updated to oxlint |
|
Ah I see, you've got: Which enables the style category. Since this rule is within the style category, oxlint will start reporting this error. The style category is off by default. If you don't want to use this rule, you'd add |
|
That makes total sense 🤦♂️ – thank you for taking a look! 🙇 |
Implements ESLint's `capitalized-comments` rule which enforces or disallows capitalization of the first letter of a comment. ## Features - Support for `"always"` (default) and `"never"` options - Configuration options: - `ignorePattern`: Regex to ignore specific comments - `ignoreInlineComments`: Ignore comments on same line as code - `ignoreConsecutiveComments`: Ignore comments following another comment - Separate configuration for line vs block comments - Directive comments (eslint-disable, etc.) are automatically ignored - URLs in comments are automatically ignored - Auto-fix support to change capitalization ## Test Plan - [x] Unit tests for pass/fail cases - [x] Fix tests for auto-fix functionality - [x] Snapshot test - [x] `cargo clippy -p oxc_linter` passes - [x] `cargo test -p oxc_linter capitalized_comments` passes Part of oxc-project#479 --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…oxc-project#16989) Follow-up to oxc-project#16896. ## Summary Treat OxLint directive comments as directives in `eslint/capitalized-comments`, so we do not warn or auto-fix them. - Ignore `oxlint-disable`, `oxlint-disable-line`, `oxlint-disable-next-line` - Ignore `oxlint-enable` and related `oxlint-` directive prefixes - Add test coverage for these directive comment styles
Implements ESLint's
capitalized-commentsrule which enforces or disallows capitalization of the first letter of a comment.Features
"always"(default) and"never"optionsignorePattern: Regex to ignore specific commentsignoreInlineComments: Ignore comments on same line as codeignoreConsecutiveComments: Ignore comments following another commentTest Plan
cargo clippy -p oxc_linterpassescargo test -p oxc_linter capitalized_commentspassesPart of #479